package com.heima.controller;


import com.heima.utils.AliyunOSSOperator;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;


@RestController
@RequestMapping("/api/vm-service/sku/fileUpload")
public class UploadController {


    @Autowired
    private AliyunOSSOperator aliyunOSSOperator;


    @PostMapping
    public String upload(@RequestParam("fileName") MultipartFile file) throws Exception {
        return aliyunOSSOperator.upload(file.getBytes(), file.getOriginalFilename());
    }

}
